import {
  getbanner,
  getsinger,
  getnewSong
} from '../../network/http'
Page({
  data: {
    bannerList: [],
    artistsList: [],
    newSongList:[]
  },
  onLoad(options) {
    this.getbannerList()
    this.getsinger()
    this.getnewSong()
  },
  async getbannerList() {
    const {
      data: res
    } = await getbanner()
    this.setData({
      bannerList: res.banners
    })
  },
  // 获取歌手
  async getsinger() {
    const { data: res} = await getsinger()
    this.setData({
      artistsList: res.artists
    })
  },
  // 获取新音乐
 async getnewSong(){
   const {data:res}=await getnewSong()
   this.setData({
    newSongList:res.result
   })
  console.log(res.result);
  },
  singsong(e){
    wx.navigateTo({
      url: `/pages/singersong/singersong?id=${e.target.dataset.id}`,
    })
  },
  // 跳转搜索页
  gosearch(){
  wx.navigateTo({
    url: '../../pages/search/search',
  })
  }
})